Public Class frmGLARTransAdd
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents rbDmemo As System.Windows.Forms.RadioButton
    Friend WithEvents rbCmemo As System.Windows.Forms.RadioButton
    Friend WithEvents rbReceipt As System.Windows.Forms.RadioButton
    Friend WithEvents rbSale As System.Windows.Forms.RadioButton
    Friend WithEvents tbDocNum As System.Windows.Forms.TextBox
    Friend WithEvents tbRefer As System.Windows.Forms.TextBox
    Friend WithEvents tbCusCode As System.Windows.Forms.TextBox
    Friend WithEvents GroupPanel1 As DevComponents.DotNetBar.Controls.GroupPanel
    Friend WithEvents GroupPanel2 As DevComponents.DotNetBar.Controls.GroupPanel
    Friend WithEvents ItemContainer9 As DevComponents.DotNetBar.ItemContainer
    Friend WithEvents LabelItem1 As DevComponents.DotNetBar.LabelItem
    Friend WithEvents cmbCustomer As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents cmbSalesman As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents LabelX4 As DevComponents.DotNetBar.LabelX
    Friend WithEvents LabelX3 As DevComponents.DotNetBar.LabelX
    Friend WithEvents LabelX2 As DevComponents.DotNetBar.LabelX
    Friend WithEvents LabelX1 As DevComponents.DotNetBar.LabelX
    Friend WithEvents cmdExit As DevComponents.DotNetBar.ButtonX
    Friend WithEvents cmdSave As DevComponents.DotNetBar.ButtonX
    Friend WithEvents lblCompany As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.tbDocNum = New System.Windows.Forms.TextBox()
        Me.rbDmemo = New System.Windows.Forms.RadioButton()
        Me.rbCmemo = New System.Windows.Forms.RadioButton()
        Me.rbReceipt = New System.Windows.Forms.RadioButton()
        Me.rbSale = New System.Windows.Forms.RadioButton()
        Me.tbRefer = New System.Windows.Forms.TextBox()
        Me.tbCusCode = New System.Windows.Forms.TextBox()
        Me.lblCompany = New System.Windows.Forms.Label()
        Me.GroupPanel1 = New DevComponents.DotNetBar.Controls.GroupPanel()
        Me.cmdExit = New DevComponents.DotNetBar.ButtonX()
        Me.cmdSave = New DevComponents.DotNetBar.ButtonX()
        Me.LabelX4 = New DevComponents.DotNetBar.LabelX()
        Me.LabelX3 = New DevComponents.DotNetBar.LabelX()
        Me.GroupPanel2 = New DevComponents.DotNetBar.Controls.GroupPanel()
        Me.LabelX2 = New DevComponents.DotNetBar.LabelX()
        Me.LabelX1 = New DevComponents.DotNetBar.LabelX()
        Me.ItemContainer9 = New DevComponents.DotNetBar.ItemContainer()
        Me.LabelItem1 = New DevComponents.DotNetBar.LabelItem()
        Me.cmbCustomer = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.cmbSalesman = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.GroupPanel1.SuspendLayout()
        Me.GroupPanel2.SuspendLayout()
        Me.SuspendLayout()
        '
        'tbDocNum
        '
        Me.tbDocNum.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbDocNum.Location = New System.Drawing.Point(83, 118)
        Me.tbDocNum.Name = "tbDocNum"
        Me.tbDocNum.Size = New System.Drawing.Size(113, 26)
        Me.tbDocNum.TabIndex = 2
        '
        'rbDmemo
        '
        Me.rbDmemo.AutoSize = True
        Me.rbDmemo.BackColor = System.Drawing.Color.Transparent
        Me.rbDmemo.Checked = True
        Me.rbDmemo.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbDmemo.Location = New System.Drawing.Point(274, 7)
        Me.rbDmemo.Name = "rbDmemo"
        Me.rbDmemo.Size = New System.Drawing.Size(103, 22)
        Me.rbDmemo.TabIndex = 42
        Me.rbDmemo.TabStop = True
        Me.rbDmemo.Text = "Debit Memo"
        Me.rbDmemo.UseVisualStyleBackColor = False
        '
        'rbCmemo
        '
        Me.rbCmemo.AutoSize = True
        Me.rbCmemo.BackColor = System.Drawing.Color.Transparent
        Me.rbCmemo.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbCmemo.Location = New System.Drawing.Point(158, 7)
        Me.rbCmemo.Name = "rbCmemo"
        Me.rbCmemo.Size = New System.Drawing.Size(107, 22)
        Me.rbCmemo.TabIndex = 43
        Me.rbCmemo.Text = "Credit Memo"
        Me.rbCmemo.UseVisualStyleBackColor = False
        '
        'rbReceipt
        '
        Me.rbReceipt.AutoSize = True
        Me.rbReceipt.BackColor = System.Drawing.Color.Transparent
        Me.rbReceipt.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbReceipt.Location = New System.Drawing.Point(73, 7)
        Me.rbReceipt.Name = "rbReceipt"
        Me.rbReceipt.Size = New System.Drawing.Size(73, 22)
        Me.rbReceipt.TabIndex = 44
        Me.rbReceipt.Text = "Receipt"
        Me.rbReceipt.UseVisualStyleBackColor = False
        '
        'rbSale
        '
        Me.rbSale.AutoSize = True
        Me.rbSale.BackColor = System.Drawing.Color.Transparent
        Me.rbSale.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbSale.Location = New System.Drawing.Point(9, 7)
        Me.rbSale.Name = "rbSale"
        Me.rbSale.Size = New System.Drawing.Size(52, 22)
        Me.rbSale.TabIndex = 45
        Me.rbSale.Text = "Sale"
        Me.rbSale.UseVisualStyleBackColor = False
        '
        'tbRefer
        '
        Me.tbRefer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbRefer.Location = New System.Drawing.Point(83, 154)
        Me.tbRefer.Name = "tbRefer"
        Me.tbRefer.Size = New System.Drawing.Size(199, 26)
        Me.tbRefer.TabIndex = 3
        '
        'tbCusCode
        '
        Me.tbCusCode.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbCusCode.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
        Me.tbCusCode.Location = New System.Drawing.Point(83, 52)
        Me.tbCusCode.Name = "tbCusCode"
        Me.tbCusCode.Size = New System.Drawing.Size(94, 26)
        Me.tbCusCode.TabIndex = 50
        '
        'lblCompany
        '
        Me.lblCompany.AutoSize = True
        Me.lblCompany.Location = New System.Drawing.Point(86, 14)
        Me.lblCompany.Name = "lblCompany"
        Me.lblCompany.Size = New System.Drawing.Size(0, 18)
        Me.lblCompany.TabIndex = 51
        '
        'GroupPanel1
        '
        Me.GroupPanel1.CanvasColor = System.Drawing.SystemColors.Control
        Me.GroupPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007
        Me.GroupPanel1.Controls.Add(Me.cmdExit)
        Me.GroupPanel1.Controls.Add(Me.cmdSave)
        Me.GroupPanel1.Controls.Add(Me.LabelX4)
        Me.GroupPanel1.Controls.Add(Me.LabelX3)
        Me.GroupPanel1.Controls.Add(Me.GroupPanel2)
        Me.GroupPanel1.Controls.Add(Me.LabelX2)
        Me.GroupPanel1.Controls.Add(Me.LabelX1)
        Me.GroupPanel1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.GroupPanel1.Location = New System.Drawing.Point(0, 0)
        Me.GroupPanel1.Name = "GroupPanel1"
        Me.GroupPanel1.Size = New System.Drawing.Size(500, 377)
        '
        '
        '
        Me.GroupPanel1.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2
        Me.GroupPanel1.Style.BackColorGradientAngle = 90
        Me.GroupPanel1.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground
        Me.GroupPanel1.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderBottomWidth = 1
        Me.GroupPanel1.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder
        Me.GroupPanel1.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderLeftWidth = 1
        Me.GroupPanel1.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderRightWidth = 1
        Me.GroupPanel1.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderTopWidth = 1
        Me.GroupPanel1.Style.CornerDiameter = 4
        Me.GroupPanel1.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded
        Me.GroupPanel1.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center
        Me.GroupPanel1.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText
        Me.GroupPanel1.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near
        Me.GroupPanel1.TabIndex = 54
        Me.GroupPanel1.Text = "AR-Customer - Add"
        '
        'cmdExit
        '
        Me.cmdExit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdExit.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdExit.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdExit.Location = New System.Drawing.Point(384, 299)
        Me.cmdExit.Name = "cmdExit"
        Me.cmdExit.Size = New System.Drawing.Size(82, 27)
        Me.cmdExit.TabIndex = 231
        Me.cmdExit.Text = "Exit"
        '
        'cmdSave
        '
        Me.cmdSave.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdSave.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdSave.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdSave.Location = New System.Drawing.Point(291, 300)
        Me.cmdSave.Name = "cmdSave"
        Me.cmdSave.Size = New System.Drawing.Size(82, 26)
        Me.cmdSave.TabIndex = 230
        Me.cmdSave.Text = "Save"
        '
        'LabelX4
        '
        Me.LabelX4.BackColor = System.Drawing.Color.Transparent
        Me.LabelX4.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.LabelX4.Location = New System.Drawing.Point(8, 171)
        Me.LabelX4.Name = "LabelX4"
        Me.LabelX4.Size = New System.Drawing.Size(66, 23)
        Me.LabelX4.TabIndex = 0
        Me.LabelX4.Text = "Salesman"
        '
        'LabelX3
        '
        Me.LabelX3.BackColor = System.Drawing.Color.Transparent
        Me.LabelX3.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.LabelX3.Location = New System.Drawing.Point(8, 94)
        Me.LabelX3.Name = "LabelX3"
        Me.LabelX3.Size = New System.Drawing.Size(66, 23)
        Me.LabelX3.TabIndex = 0
        Me.LabelX3.Text = "Doc #"
        '
        'GroupPanel2
        '
        Me.GroupPanel2.CanvasColor = System.Drawing.SystemColors.Control
        Me.GroupPanel2.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007
        Me.GroupPanel2.Controls.Add(Me.rbDmemo)
        Me.GroupPanel2.Controls.Add(Me.rbCmemo)
        Me.GroupPanel2.Controls.Add(Me.rbSale)
        Me.GroupPanel2.Controls.Add(Me.rbReceipt)
        Me.GroupPanel2.Location = New System.Drawing.Point(80, 213)
        Me.GroupPanel2.Name = "GroupPanel2"
        Me.GroupPanel2.Size = New System.Drawing.Size(386, 69)
        '
        '
        '
        Me.GroupPanel2.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2
        Me.GroupPanel2.Style.BackColorGradientAngle = 90
        Me.GroupPanel2.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground
        Me.GroupPanel2.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel2.Style.BorderBottomWidth = 1
        Me.GroupPanel2.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder
        Me.GroupPanel2.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel2.Style.BorderLeftWidth = 1
        Me.GroupPanel2.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel2.Style.BorderRightWidth = 1
        Me.GroupPanel2.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel2.Style.BorderTopWidth = 1
        Me.GroupPanel2.Style.CornerDiameter = 4
        Me.GroupPanel2.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded
        Me.GroupPanel2.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center
        Me.GroupPanel2.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText
        Me.GroupPanel2.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near
        Me.GroupPanel2.TabIndex = 54
        Me.GroupPanel2.Text = "Document Type"
        '
        'LabelX2
        '
        Me.LabelX2.BackColor = System.Drawing.Color.Transparent
        Me.LabelX2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.LabelX2.Location = New System.Drawing.Point(8, 132)
        Me.LabelX2.Name = "LabelX2"
        Me.LabelX2.Size = New System.Drawing.Size(66, 23)
        Me.LabelX2.TabIndex = 0
        Me.LabelX2.Text = "Details"
        '
        'LabelX1
        '
        Me.LabelX1.BackColor = System.Drawing.Color.Transparent
        Me.LabelX1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.LabelX1.Location = New System.Drawing.Point(8, 31)
        Me.LabelX1.Name = "LabelX1"
        Me.LabelX1.Size = New System.Drawing.Size(66, 23)
        Me.LabelX1.TabIndex = 0
        Me.LabelX1.Text = "Customer"
        '
        'ItemContainer9
        '
        '
        '
        '
        Me.ItemContainer9.BackgroundStyle.Class = "RibbonFileMenuColumnTwoContainer"
        Me.ItemContainer9.LayoutOrientation = DevComponents.DotNetBar.eOrientation.Vertical
        Me.ItemContainer9.MinimumSize = New System.Drawing.Size(180, 0)
        Me.ItemContainer9.Name = "ItemContainer9"
        '
        'LabelItem1
        '
        Me.LabelItem1.BorderSide = DevComponents.DotNetBar.eBorderSide.Bottom
        Me.LabelItem1.BorderType = DevComponents.DotNetBar.eBorderType.Etched
        Me.LabelItem1.CanCustomize = False
        Me.LabelItem1.Name = "LabelItem1"
        '
        'cmbCustomer
        '
        Me.cmbCustomer.DisplayMember = "Text"
        Me.cmbCustomer.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbCustomer.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbCustomer.ItemHeight = 19
        Me.cmbCustomer.Location = New System.Drawing.Point(83, 83)
        Me.cmbCustomer.Name = "cmbCustomer"
        Me.cmbCustomer.Size = New System.Drawing.Size(386, 25)
        Me.cmbCustomer.TabIndex = 55
        '
        'cmbSalesman
        '
        Me.cmbSalesman.DisplayMember = "Text"
        Me.cmbSalesman.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbSalesman.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbSalesman.ItemHeight = 19
        Me.cmbSalesman.Location = New System.Drawing.Point(83, 193)
        Me.cmbSalesman.Name = "cmbSalesman"
        Me.cmbSalesman.Size = New System.Drawing.Size(301, 25)
        Me.cmbSalesman.TabIndex = 56
        '
        'frmGLARTransAdd
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(7, 19)
        Me.BackColor = System.Drawing.SystemColors.ActiveCaption
        Me.ClientSize = New System.Drawing.Size(500, 377)
        Me.ControlBox = False
        Me.Controls.Add(Me.cmbCustomer)
        Me.Controls.Add(Me.cmbSalesman)
        Me.Controls.Add(Me.tbRefer)
        Me.Controls.Add(Me.tbCusCode)
        Me.Controls.Add(Me.tbDocNum)
        Me.Controls.Add(Me.lblCompany)
        Me.Controls.Add(Me.GroupPanel1)
        Me.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frmGLARTransAdd"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.GroupPanel1.ResumeLayout(False)
        Me.GroupPanel2.ResumeLayout(False)
        Me.GroupPanel2.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region
    Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
        If ValidateInputData() = True Then
            GlArCusID = cmbCustomer.SelectedValue
            GlArCusName = "A/R:" & cmbCustomer.Text
            GlArDocNum = tbDocNum.Text
            GlArSMan = cmbSalesman.SelectedValue

            If rbDmemo.Checked = True Then
                GlArDocType = "D"
            End If
            If rbCmemo.Checked = True Then
                GlArDocType = "C"
            End If
            If rbSale.Checked = True Then
                GlArDocType = "S"
            End If
            If rbReceipt.Checked = True Then
                GlArDocType = "R"
            End If
            GlArDocRefer = tbRefer.Text
            Me.Close()
        End If
    End Sub

    Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
        If ValidateInputData() = True Then
            GlArCusID = cmbCustomer.SelectedValue
            GlArDocNum = tbDocNum.Text
            GlArCusName = "A/R:" & cmbCustomer.Text
            If rbDmemo.Checked = True Then
                GlArDocType = "D"
            End If
            If rbCmemo.Checked = True Then
                GlArDocType = "C"
            End If
            If rbSale.Checked = True Then
                GlArDocType = "S"
            End If
            If rbReceipt.Checked = True Then
                GlArDocType = "R"
            End If
            GlArDocRefer = tbRefer.Text
            Me.Close()
        End If
    End Sub

    Private Sub ARgroupsAdd_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim ICdata As New ICdataLogic
        Dim ds2, dsss As DataSet

        dsss = ICdata.GetSalesMan(ArCompanyID)
        cmbSalesman.DataSource = dsss.Tables(0)
        cmbSalesman.ValueMember = "SALESMANID"
        cmbSalesman.DisplayMember = "SALESMANNAME"

        ds2 = ICdata.GetCompanyCustomers(ArCompanyID)
        cmbCustomer.DataSource = ds2.Tables(0)
        cmbCustomer.ValueMember = "CusID"
        cmbCustomer.DisplayMember = "CusName"
        If IsNumeric(GlArCusID) Then
            If GlArCusID > 0 Then
                cmbCustomer.SelectedValue = GlArCusID
                Dim ARdata As New ARdataLogic
                Dim CusCode As String
                CusCode = ARdata.GetCustomerCode(GlArCusID)
                tbCusCode.Text = CusCode
                ARdata = Nothing
                tbDocNum.Text = GlArDocNum
                If GlArDocType = "S" Then
                    rbSale.Checked = True
                End If
                If GlArDocType = "R" Then
                    rbReceipt.Checked = True
                End If
                If GlArDocType = "D" Then
                    rbDmemo.Checked = True
                End If
                If GlArDocType = "C" Then
                    rbCmemo.Checked = True
                End If
                tbRefer.Text = GlArDocRefer
            End If
        End If

    End Sub
    Private Function ValidateInputData() As Boolean
        If Not IsNumeric(cmbCustomer.SelectedValue) Then
            MsgBox("Select Customer", MsgBoxStyle.Critical, "Inventory Manager")
            cmbCustomer.Focus()
            Return False
        End If
        Return True
    End Function
    Private Sub cbCustomer_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
        AutoCompleteCombo_KeyUp(cmbCustomer, e)
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub
    Private Sub cbCustomer_Leave(ByVal sender As Object, ByVal e As System.EventArgs)
        AutoCompleteCombo_Leave(cmbCustomer)
    End Sub
    Private Sub tbCusCode_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbCusCode.LostFocus
        If tbCusCode.Text.Trim <> "" Then
            Dim ARdata As New ARdataLogic
            Dim CusID As Integer
            CusID = ARdata.GetCustomerID(tbCusCode.Text)
            If CusID = 0 Then
                MsgBox("Invalid Customer Code!", MsgBoxStyle.Critical, "Inventory Manager")
                tbCusCode.Clear()
            Else
                cmbCustomer.SelectedValue = CusID
            End If
        End If
    End Sub

    Private Sub cbCustomer_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbCustomer.SelectedIndexChanged
        If IsNumeric(cmbCustomer.SelectedValue) Then
            Dim ARdata As New ARdataLogic
            Dim CusCode As String
            CusCode = ARdata.GetCustomerCode(cmbCustomer.SelectedValue)
            If CusCode.Trim = "" Then
                MsgBox("Invalid Customer!", MsgBoxStyle.Critical, "Inventory Manager")
                tbCusCode.Clear()
            Else
                tbCusCode.Text = CusCode
            End If
        End If
    End Sub

    
    
End Class
